home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 13 / FreelogHS13.iso / P To P / Emule24b_Morph_Mod_V4b-binary / Webserver / menu.js < prev    next >
Text File  |  2002-12-04  |  3KB  |  99 lines

  1. var oContentmenu=new Array();
  2.  
  3. function createContentMenu(width)
  4. {
  5.   var num=oContentmenu.length;
  6.   num++;
  7.  
  8.   var str='<div id="divContentMenu'+num+'" class="clContentMenu"></div>';
  9.   document.write(str);
  10.  
  11.   oContentmenu[num]=new lib_obj('divContentMenu'+num,"","","",num);
  12.   oContentmenu[num].id=num;
  13.   oContentmenu[num].x=0;
  14.   oContentmenu[num].y=0;
  15.   oContentmenu[num].width=width;
  16.   oContentmenu[num].xOffset=0;
  17.   oContentmenu[num].yOffset=0;
  18.   oContentmenu[num].content="";
  19.   oContentmenu[num].timer=false;
  20.   oContentmenu[num].stillin=false;
  21.   oContentmenu[num].show=menuShow;
  22.   oContentmenu[num].hide=menuHide;
  23.   oContentmenu[num].over=menuOver;
  24.   oContentmenu[num].addMenuElement=addMenu;
  25.   oContentmenu[num].elementCount=0;
  26.   oContentmenu[num].alterContent=menuContent;
  27.   oContentmenu[num].evnt.onmouseover=new Function("oContentmenu["+num+"].over();")
  28.   oContentmenu[num].evnt.onmouseout=new Function("oContentmenu["+num+"].hide();")
  29.   return oContentmenu[num];
  30. }
  31.  
  32. function menuShow()
  33. {
  34.   this.moveIt(this.x+this.xOffset,this.y+this.yOffset);
  35.   this.showIt();
  36.   this.timer=false;
  37.   this.stillin=true;
  38.   return false;
  39. }
  40.  
  41. function menuOver()
  42. {
  43.   this.stillin=true;
  44.   if(this.timer!=false)
  45.   {
  46.     clearTimeout(this.timer);
  47.     this.timer=false;
  48.   }
  49.   return false;
  50. }
  51.  
  52. function menuHide()
  53. {
  54.   if(this.stillin==true)
  55.   {
  56.     this.stillin=false;
  57.     this.timer=setTimeout("oContentmenu["+this.id+"].hide();",500);
  58.   }
  59.   else
  60.     this.hideIt();
  61.   return false;
  62. }
  63.  
  64. function menuContent(content)
  65. {
  66.   setContent(content,"divContentMenu"+this.id);
  67. }
  68.  
  69. function addMenu(name,action,highlight,overaction,outaction)
  70. {
  71.   if(name)
  72.   {
  73.     this.content+='<table border="0" cellspacing="0" cellpadding="0" id="menu'+this.id+'_'+this.elementCount+'" '
  74.     +'onClick="'+action+'" width="'+this.width+'"';
  75.     if(highlight)
  76.     {
  77.       this.content+=' onMouseover="menu'+this.id+'_'+this.elementCount+'.style.setAttribute(\'backgroundcolor\',\'black\',false);menu'+this.id+'_'+this.elementCount+'.style.color=\'white\';';
  78.       if(overaction)
  79.         this.content+=overaction;
  80.       this.content+='" onMouseout="menu'+this.id+'_'+this.elementCount+'.style.removeAttribute(\'backgroundcolor\',false);menu'+this.id+'_'+this.elementCount+'.style.color=\'black\';';
  81.       if(outaction)
  82.         this.content+=outaction;
  83.       this.content+='"';
  84.     }
  85.     else
  86.     {
  87.       if(overaction)
  88.         this.content+=' onMouseover="'+overaction+'"';
  89.       if(outaction)
  90.         this.content+=' onMouseout="'+outaction+'"';
  91.     }
  92.     this.content+='><tr><td><a class="clContentMenuText"><nobr>'+name+'</nobr></a></td></tr></table>';
  93.   }
  94.   else
  95.     this.content+='<hr width="'+this.width+'"/>';
  96.   this.alterContent(this.content);
  97.   this.elementCount++;
  98. }
  99.